﻿using Rhino;
using Rhino.Commands;
using System;
using System.Collections;
using System.Collections.Generic;
using Rhino.Input;
using Rhino.Input.Custom;
using YangTools.Realization;

namespace YangTools
{
    public class BlockSubObjectsColorSourceCommand : Command
    {
        static BlockSubObjectsColorSourceCommand _instance;
        public BlockSubObjectsColorSourceCommand()
        {
            _instance = this;
        }

        public static BlockSubObjectsColorSourceCommand Instance
        {
            get { return _instance; }
        }

        public override string EnglishName { get { return "BlockSubObjectsColorSource"; } }

        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            // 通过选项控制子物体颜色来源
            var go = new GetOption();
            go.AddOptionEnumList("图块子物体颜色来源", Rhino.DocObjects.ObjectColorSource.ColorFromParent);
            var r = go.Get();
            if (r == GetResult.Option)
            {
                var source = go.GetSelectedEnumValue<Rhino.DocObjects.ObjectColorSource>();
                BlockSubObjects bo = new BlockSubObjects();
                bo.ColorAs(source);
            }
            return Result.Success;
        }
    }
}